Skip to content

Conversation

@voidcooks
Copy link
Contributor

@voidcooks voidcooks commented Nov 5, 2025

Summary by Sourcery

Improve snapshot command handling, add macOS Docker support and tests, and update installation instructions.

New Features:

  • Add macOS Docker support with a dedicated docker-run-macos.sh script and Dockerfile
  • Include a test script to validate snapshot commands in Docker environments

Bug Fixes:

  • Handle the snapshot command early to avoid requiring keypair or Solana config

Enhancements:

  • Support NO_COLOR environment variable to control snapshot output coloration

Documentation:

  • Revise README to separate Linux build instructions and macOS Docker usage

Tests:

  • Add test-scripts/test-snapshot-docker.sh for automated Docker-based snapshot testing

@devloai
Copy link
Contributor

devloai bot commented Nov 5, 2025

Unable to perform a code review. You have run out of credits 😔
Please upgrade your plan or buy additional credits from the subscription page.

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 5, 2025

Reviewer's Guide

This PR refactors command dispatch to handle snapshots earlier, enhances snapshot output configuration, updates installation docs with Linux and macOS Docker workflows, and adds macOS Docker support artifacts including a runner script, Dockerfile, and automated snapshot tests.

Sequence diagram for early snapshot command handling

sequenceDiagram
    participant User
    participant CLI
    participant SnapshotHandler
    User->>CLI: osvm snapshot [args]
    CLI->>SnapshotHandler: execute_snapshot_command(sub_matches)
    SnapshotHandler-->>CLI: Result
    CLI-->>User: Output
Loading

Class diagram for updated OutputConfig in snapshot command

classDiagram
    class OutputConfig {
        +OutputFormat format
        +bool colorized
        +bool quiet
        +bool show_progress
        +bool human_readable
    }
    OutputConfig : colorized is now set by NO_COLOR env var
    OutputConfig : format set by --json flag
    OutputConfig : quiet set by --quiet flag
    OutputConfig : show_progress set by !quiet
    OutputConfig : human_readable set by !json
Loading

File-Level Changes

Change Details Files
Revise installation instructions with Linux build and macOS Docker usage
  • Refactor install steps for cloning, building, and installing on Linux
  • Add a macOS section demonstrating Docker-based commands
  • Demonstrate usage examples for snapshot and eval via Docker script
README.md
Introduce early dispatch for snapshot command in main
  • Insert a branch for snapshot prior to keypair/config initialization
  • Dispatch to execute_snapshot_command directly
  • Propagate errors via .map_err
src/main.rs
Update snapshot output configuration to respect NO_COLOR env
  • Check NO_COLOR environment variable to toggle color
  • Replace flag-based color logic with env-driven approach
src/commands/snapshot.rs
Add macOS Docker support assets and snapshot test script
  • Add scripts/docker-run-macos.sh to build and run container on macOS
  • Introduce scripts/docker/Dockerfile-macos for macOS image
  • Include test-scripts/test-snapshot-docker.sh to automate snapshot tests in Docker
scripts/docker-run-macos.sh
scripts/docker/Dockerfile-macos
test-scripts/test-snapshot-docker.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • In get_output_config, consider combining the NO_COLOR env var check with the --no-color flag so users can override colors via the CLI flag.
  • README macOS usage example has "ovsm eval"; it should reference the correct binary name "osvm eval".
  • docker-run-macos.sh mounts ~/.osvm into the container without setting a user, which can lead to permission issues—consider adding a --user flag or adjusting ownership.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In get_output_config, consider combining the NO_COLOR env var check with the --no-color flag so users can override colors via the CLI flag.
- README macOS usage example has "ovsm eval"; it should reference the correct binary name "osvm eval".
- docker-run-macos.sh mounts ~/.osvm into the container without setting a user, which can lead to permission issues—consider adding a --user flag or adjusting ownership.

## Individual Comments

### Comment 1
<location> `src/commands/snapshot.rs:184-193` </location>
<code_context>
 }

 fn get_output_config(matches: &ArgMatches) -> Result<OutputConfig> {
+    // Check environment variable for NO_COLOR or flag
+    let colorized = std::env::var("NO_COLOR").is_err();
+    
     Ok(OutputConfig {
         format: if matches.get_flag("json") {
             crate::services::snapshot_service::OutputFormat::Json
         } else {
             crate::services::snapshot_service::OutputFormat::Text
         },
-        colorized: !matches.get_flag("no-color"),
+        colorized,
         quiet: matches.get_flag("quiet"),
         show_progress: !matches.get_flag("quiet"),
</code_context>

<issue_to_address>
**suggestion:** NO_COLOR environment variable now overrides the CLI flag for colorized output.

Consider updating the logic so that either the NO_COLOR environment variable or the --no-color flag disables color output, or clarify in the documentation that NO_COLOR takes precedence over the flag.
</issue_to_address>

### Comment 2
<location> `src/commands/snapshot.rs:195` </location>
<code_context>
-        colorized: !matches.get_flag("no-color"),
+        colorized,
         quiet: matches.get_flag("quiet"),
         show_progress: !matches.get_flag("quiet"),
         human_readable: !matches.get_flag("json"),
</code_context>

<issue_to_address>
**suggestion:** show_progress is tied to the quiet flag, but not to output format.

Disabling progress when JSON output is selected will prevent issues with machine parsing. Please update the logic accordingly unless progress in JSON is required.

```suggestion
        show_progress: !matches.get_flag("quiet") && !matches.get_flag("json"),
```
</issue_to_address>

### Comment 3
<location> `README.md:70` </location>
<code_context>
+
+# Use any command
+./scripts/docker-run-macos.sh snapshot --help
+./scripts/docker-run-macos.sh ovsm eval '(+ 1 2 3)'
 ```

</code_context>

<issue_to_address>
**issue (typo):** Possible typo: 'ovsm' should likely be 'osvm'.

Please update 'ovsm' to 'osvm' for consistency with the rest of the documentation and repository.

```suggestion
./scripts/docker-run-macos.sh osvm eval '(+ 1 2 3)'
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

colorized: !matches.get_flag("no-color"),
colorized,
quiet: matches.get_flag("quiet"),
show_progress: !matches.get_flag("quiet"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: show_progress is tied to the quiet flag, but not to output format.

Disabling progress when JSON output is selected will prevent issues with machine parsing. Please update the logic accordingly unless progress in JSON is required.

Suggested change
show_progress: !matches.get_flag("quiet"),
show_progress: !matches.get_flag("quiet") && !matches.get_flag("json"),


# Use any command
./scripts/docker-run-macos.sh snapshot --help
./scripts/docker-run-macos.sh ovsm eval '(+ 1 2 3)'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): Possible typo: 'ovsm' should likely be 'osvm'.

Please update 'ovsm' to 'osvm' for consistency with the rest of the documentation and repository.

Suggested change
./scripts/docker-run-macos.sh ovsm eval '(+ 1 2 3)'
./scripts/docker-run-macos.sh osvm eval '(+ 1 2 3)'

@voidcooks
Copy link
Contributor Author

voidcooks commented Nov 5, 2025

I'm not naive enough to believe there's not something else we need to do outside of this granted you asked me to fix it (which I'm looking into now), but this should be fixed regardless for the random folks running this locally etc.

EDIT: maybe not... works fine with or without keypair. Can you please elaborate on what the specific bug is you would like help with?

@voidcooks
Copy link
Contributor Author

Also, fwiw, I couldn't get vsock to cooperate on my Mac (worked fine on my linux machine), so that's why I made this workaround to use Docker. Maybe I'm wrong, but that's my thinking here.

@0xrinegade 0xrinegade requested a review from Copilot November 6, 2025 00:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Docker support for macOS users, enabling them to run OSVM CLI in a containerized environment. The changes provide a workaround for macOS users who may face native build issues while maintaining the existing Linux build workflow.

  • Adds macOS-specific Docker infrastructure (Dockerfile and run script)
  • Updates installation instructions in README to document both Linux (native) and macOS (Docker) installation methods
  • Moves snapshot command handling earlier in main.rs execution flow to avoid unnecessary config loading
  • Fixes NO_COLOR environment variable handling in snapshot command to align with standard behavior

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test-scripts/test-snapshot-docker.sh Adds integration test for verifying snapshot commands work correctly inside Docker container
scripts/docker/Dockerfile-macos New multi-stage Dockerfile for building OSVM CLI for macOS users
scripts/docker-run-macos.sh Helper script to build and run OSVM in Docker with proper volume mounts for configuration
src/main.rs Adds early handling of snapshot command to avoid unnecessary keypair/config loading
src/commands/snapshot.rs Updates NO_COLOR environment variable handling to correctly respect the standard
README.md Documents macOS Docker installation method alongside existing Linux native installation

@@ -0,0 +1,55 @@
#!/bin/bash
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the project's "NO STANDALONE SCRIPTS POLICY". According to .github/copilot-instructions.md, all functionality must be implemented in Rust and compiled into the osvm binary. Standalone shell scripts are explicitly forbidden. Consider implementing this test functionality as a Rust integration test or as an osvm subcommand (e.g., osvm test snapshot-docker).

Copilot generated this review using guidance from repository custom instructions.
@@ -0,0 +1,24 @@
#!/bin/bash
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the project's "NO STANDALONE SCRIPTS POLICY". According to .github/copilot-instructions.md, all functionality must be implemented in Rust and compiled into the osvm binary. Consider implementing Docker orchestration as a Rust-based osvm subcommand (e.g., osvm docker run) that handles the container lifecycle, or document this as a temporary developer convenience script with a plan to migrate to Rust.

Copilot generated this review using guidance from repository custom instructions.
@0xrinegade 0xrinegade merged commit 13bcacc into openSVM:main Nov 6, 2025
15 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants